package com.ftg.learn.day08.manytomany;

import com.ftg.learn.day08.SexEnum;
import com.sun.org.apache.xml.internal.serializer.ToSAXHandler;

/**
 * 学生类
 *
 * @author 布衣
 */
public class Student {

    String name;
    private SexEnum sex;
    //康加修 男
    public Student createStudent(String name,SexEnum sex){
        this.name = name;
        this.setSex(sex);
        return this;
    }

    @Override
    public String toString() {
       return "[name="+this.getName()+",sex="+this.getSex()+"]";
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getSex() {
        return sex.getSex();
    }

    public void setSex(SexEnum sex){
        this.sex = sex;
    }

//    public void setSex(String sex) {
//        if("".equals(sex)){
//            throw new RuntimeException("性别不能空");
//        }
//        if("男".equals(sex)||"女".equals(sex)){
//            this.sex = sex;
//        }else{
//            throw new RuntimeException("性别只能为男，女");
//        }
//    }
}
